//
//  ZCScraping.h
//  PicUploader
//
//  Created by Chen Zhang on 8/16/08.
//  Copyright 2008 overboming. All rights reserved.
//

#import <Cocoa/Cocoa.h>
@class AppController;
@class PUPicture;

@interface ZCScraping : NSObject {
    AppController *controler;
    NSString *userid;
    NSString *password;
    NSString *cookiestring;
}

- (NSString *)ConvertDataToString:(NSData *)data;
- (NSString *)PostToWebPage:(NSString *)uurl withData:(NSString *)post;
- (NSString *)FetchWebPage:(NSString *)uurl;
- (void)Login;
- (NSString *)Logout;
- (void) UploadFileWithPath:(NSString *)path toURL:(NSString *)uurl withBoardName:(NSString *)board;
- (void) uploadSucceeded:(BOOL) bo;
- (void) UploadFileThreadWithPath:(NSString *)path toURL:(NSString *)uurl withBoardName:(NSString *)board;
- (void) UploadThreadBranch:(id)path;

- (NSURLRequest *)postRequestWithURL: (NSURL *)url        
                             boundry: (NSString *)boundry 
                                data: (NSData *)data
                            filename:(NSString *)filename
                           boardname:(NSString *)boardname;

- (id) initWithUserName:(NSString *)username Password:(NSString *)passcode Controller:(AppController *)ctrl;
- (NSString *)getFileNameFromPath: (NSString *) path;
- (NSString *)getContentTypeFromFileName:(NSString *)filename;
- (NSString *)parseCookieFromHTML:(NSString *)html;
- (NSRange)getCookieContentFromString:(NSString *) subst;
- (NSString *)getStoredFileName:(NSString *)result;
- (BOOL) detectLoggedIn;
- (NSString *) loginValidation:(NSString *)html;
- (NSString *)PostArticle:(NSString *)boardname withData:(NSString *)postString;
- (NSString *)PostSuggestion:(NSString *)postString;
- (void)retrySheet:(NSWindow *)sheet
              code:(int)returnCode
           context:(void *)contextInfo;


@property (readwrite,copy) NSString *userid;
@property (readwrite,copy) NSString *password;
@property (readwrite,copy) NSString *cookiestring;
@end
